/*
 *
 * 此类来自 https://gitee.com/geek_qi/cloud-platform/blob/master/ace-common/src/main/java/com/github/wxiaoqi/security/common/vo/TreeNode.java
 * @ Apache-2.0
 */


package com.xgit.iov.common.core.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ace
 * @author lengleng
 * @date 2017年11月9日23:33:45
 */
@Data
public class TreeNode {
	@JsonSerialize(using= ToStringSerializer.class)
	protected Long id;
	@JsonSerialize(using= ToStringSerializer.class)
	protected Long parentId;
	protected List<TreeNode> children = new ArrayList<TreeNode>();

	public void add(TreeNode node) {
		children.add(node);
	}

	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private Boolean hasChildren;
//
//	public Boolean getHasChildren() {
//		return this.children.size() > 0 ? true : this.hasChildren;
//	}
}
